{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This example shows how ring substitutions are handled."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from rdkit import Chem\n",
    "from rdkit.Chem.Draw import IPythonConsole\n",
    "IPythonConsole.ipython_useSVG=True\n",
    "from rdkit.Chem import rdRGroupDecomposition\n",
    "from IPython.display import HTML\n",
    "from rdkit import rdBase\n",
    "rdBase.DisableLog(\"rdApp.debug\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from rdkit.Chem import PandasTools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "core = Chem.MolFromSmarts(\"*1CCCC1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcIAAACWCAIAAADCEh9HAAAABmJLR0QA/wD/AP+gvaeTAAANlUlEQVR4nO3de0zV9R/H8cPlcNMgQxBwIKQSGwuhJAZIkb8hKlTCRARthNVcNkVzbulscytG9k/LNrQsKYVFDAltMBCiuMgQdDoYoZbEScGDnXnhfjicc35/2IqOlsq5fM75nufjPz9uh9cf+jqfz+f75hwHvV4vAwDMlKPoAABg26hRADAKNQoARqFGAcAo1Chsnk6n02g0olPAflGjsG2FhYXz588vLi4WHQT2ixqFbZPL5UqlsqWl5fr16xcuXBAdB/bIgblR2ISJiYmamhqVSvXGG29MX799+7ZCoZDL5YmJiR4eHhcuXHj88cdFhYR9okZhGy5fvvzUU095e3srlUpnZ2eDv9VoNAkJCV5eXseOHfP19RWSEHbL8J8jYA3u3Lnj5eU1fSU0NDQrKysqKmpycvLeGpXL5dXV1XPmzHFwcLBgTEAmYzcKK5STk1NaWtrR0RERESE6C/BgPGKC1fHw8NDpdOfOnRMdBHg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D4MX2Z8/4LAFxKh+etDsXMtsexP6m2LKfgcEBmb0fSQ2YLQYA3MxX/ZXwfOgAAAC0elRYdE1PTCByZGtpdCAyMDIxLjAzLjFkZXYxAAB4nKWRMQrDMAxFd53izwEb2bITPMedSjt0yB269/5UthM3hRZKKjS8L6yPZBFK3PL5/kAPn4mAWJM/ZkoJi2dmKu+d9dOoZRi2WiuElQZ8s9gntQ5JQVY/J3HnMv/sYpxl8dJ6p/g2yxEX84fLayNzfCOn5wDGJpSkC6XQRajHWkWsbVUs9T8xNPCYG8gGYYOocAFO10xPRyRSPmi2Qu4AAABoelRYdFNNSUxFUyByZGtpdCAyMDIxLjAzLjFkZXYxAAB4nE2LSwqAMAwFr+JSJQn50oYuexZv0cMbEMW3mzfMKbMm29qFtEV2QCd37nmhNBhMlq51lxYLg4FCbKoJTC1+iA9/Ab7FsW4rBBSofqD72AAAAABJRU5ErkJggg==\n",
      "image/svg+xml": [
       "<?xml version='1.0' encoding='iso-8859-1'?>\n",
       "<svg version='1.1' baseProfile='full'\n",
       "              xmlns='http://www.w3.org/2000/svg'\n",
       "                      xmlns:rdkit='http://www.rdkit.org/xml'\n",
       "                      xmlns:xlink='http://www.w3.org/1999/xlink'\n",
       "                  xml:space='preserve'\n",
       "width='450px' height='150px' viewBox='0 0 450 150'>\n",
       "<!-- END OF HEADER -->\n",
       "<rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='450' height='150' x='0' y='0'> </rect>\n",
       "<path class='bond-0' d='M 279.268,64.3282 L 258.376,35.5732' style='fill:none;fill-rule:evenodd;stroke:#191919;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path class='bond-0' d='M 258.376,35.5732 L 237.484,6.81818' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path class='bond-4' d='M 286.372,75.8933 L 261.928,109.538' style='fill:none;fill-rule:evenodd;stroke:#191919;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path class='bond-4' d='M 261.928,109.538 L 237.484,143.182' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path class='bond-1' d='M 237.484,6.81818 L 157.332,32.8613' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path class='bond-2' d='M 157.332,32.8613 L 157.332,117.139' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path class='bond-3' d='M 157.332,117.139 L 237.484,143.182' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-dasharray:2,6' />\n",
       "<path  class='atom-0' d='M 282.521 72.3368\n",
       "L 286.027 68.7635\n",
       "L 281.375 67.8196\n",
       "L 282.083 65.4261\n",
       "L 286.364 67.5836\n",
       "L 285.757 62.8978\n",
       "L 288.286 62.8641\n",
       "L 287.578 67.5499\n",
       "L 291.926 65.5272\n",
       "L 292.668 67.8196\n",
       "L 287.949 68.6961\n",
       "L 291.32 72.3031\n",
       "L 289.263 73.7864\n",
       "L 286.937 69.3366\n",
       "L 284.577 73.7864\n",
       "L 282.521 72.3368\n",
       "' fill='#191919'/>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<rdkit.Chem.rdchem.Mol at 0x7f62b914cee0>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "core"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "smiles = [\"C1CCCC1-C2CCC2Cl\", \"N1CCCC1-C2CCC2Cl\", \"O1CCCC1-C2CCC2Cl\", \"N1OCCC1-C2CCC2Cl\", \"N1OCSC1-C2CCC2Cl\"]\n",
    "\n",
    "mols = [Chem.MolFromSmiles(smi) for smi in smiles]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:rdkit=\"http://www.rdkit.org/xml\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" baseProfile=\"full\" xml:space=\"preserve\" width=\"600px\" height=\"400px\" viewBox=\"0 0 600 400\">\n",
       "<!-- END OF HEADER -->\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"600\" height=\"400\" x=\"0\" y=\"0\"> </rect>\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"600\" height=\"400\" x=\"0\" y=\"0\"> </rect>\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"600\" height=\"400\" x=\"0\" y=\"0\"> </rect>\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"600\" height=\"400\" x=\"0\" y=\"0\"> </rect>\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"600\" height=\"400\" x=\"0\" y=\"0\"> </rect>\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"600\" height=\"400\" x=\"0\" y=\"0\"> </rect>\n",
       "<path class=\"bond-0\" d=\"M 138.846,126.454 L 183.91,119.171\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 138.846,126.454 L 117.994,85.8462\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 183.91,119.171 L 190.909,74.0616\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2\" d=\"M 190.909,74.0616 L 150.171,53.4659\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3\" d=\"M 150.171,53.4659 L 117.994,85.8462\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4\" d=\"M 117.994,85.8462 L 72.8848,78.8474\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5\" d=\"M 72.8848,78.8474 L 45.9367,42.0016\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10\" d=\"M 72.8848,78.8474 L 36.039,105.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6\" d=\"M 45.9367,42.0016 L 9.09091,68.9497\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7\" d=\"M 9.09091,68.9497 L 36.039,105.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 36.039,105.795 L 33.1048,124.707\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 33.1048,124.707 L 30.1706,143.619\" style=\"fill:none;fill-rule:evenodd;stroke:#00CC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"atom-9\" d=\"M 24.0554 151.352 Q 24.0554 148.138, 25.5526 146.458 Q 27.0682 144.76, 29.9349 144.76 Q 32.6008 144.76, 34.0251 146.641 L 32.8199 147.627 Q 31.7791 146.258, 29.9349 146.258 Q 27.9812 146.258, 26.9404 147.572 Q 25.9178 148.869, 25.9178 151.352 Q 25.9178 153.908, 26.9769 155.223 Q 28.0542 156.538, 30.1358 156.538 Q 31.56 156.538, 33.2216 155.679 L 33.7329 157.049 Q 33.0573 157.487, 32.0348 157.743 Q 31.0122 157.998, 29.8802 157.998 Q 27.0682 157.998, 25.5526 156.282 Q 24.0554 154.566, 24.0554 151.352 \" fill=\"#00CC00\"/>\n",
       "<path class=\"atom-9\" d=\"M 35.5954 143.975 L 37.2753 143.975 L 37.2753 157.834 L 35.5954 157.834 L 35.5954 143.975 \" fill=\"#00CC00\"/>\n",
       "<path class=\"bond-0\" d=\"M 344.89,125.477 L 364.4,122.324\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0\" d=\"M 364.4,122.324 L 383.91,119.171\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 334.941,118.849 L 326.467,102.348\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 326.467,102.348 L 317.994,85.8462\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 383.91,119.171 L 390.909,74.0616\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2\" d=\"M 390.909,74.0616 L 350.171,53.4659\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3\" d=\"M 350.171,53.4659 L 317.994,85.8462\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4\" d=\"M 317.994,85.8462 L 272.885,78.8474\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5\" d=\"M 272.885,78.8474 L 245.937,42.0016\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10\" d=\"M 272.885,78.8474 L 236.039,105.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6\" d=\"M 245.937,42.0016 L 209.091,68.9497\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7\" d=\"M 209.091,68.9497 L 236.039,105.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 236.039,105.795 L 233.105,124.707\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 233.105,124.707 L 230.171,143.619\" style=\"fill:none;fill-rule:evenodd;stroke:#00CC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"atom-0\" d=\"M 322.312 119.99 L 324.065 119.99 L 324.065 125.486 L 330.675 125.486 L 330.675 119.99 L 332.428 119.99 L 332.428 132.918 L 330.675 132.918 L 330.675 126.947 L 324.065 126.947 L 324.065 132.918 L 322.312 132.918 L 322.312 119.99 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-0\" d=\"M 335.989 119.99 L 340.225 126.837 Q 340.645 127.513, 341.32 128.736 Q 341.996 129.96, 342.033 130.033 L 342.033 119.99 L 343.749 119.99 L 343.749 132.918 L 341.978 132.918 L 337.431 125.431 Q 336.902 124.555, 336.336 123.551 Q 335.788 122.546, 335.623 122.236 L 335.623 132.918 L 333.944 132.918 L 333.944 119.99 L 335.989 119.99 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-9\" d=\"M 224.055 151.352 Q 224.055 148.138, 225.553 146.458 Q 227.068 144.76, 229.935 144.76 Q 232.601 144.76, 234.025 146.641 L 232.82 147.627 Q 231.779 146.258, 229.935 146.258 Q 227.981 146.258, 226.94 147.572 Q 225.918 148.869, 225.918 151.352 Q 225.918 153.908, 226.977 155.223 Q 228.054 156.538, 230.136 156.538 Q 231.56 156.538, 233.222 155.679 L 233.733 157.049 Q 233.057 157.487, 232.035 157.743 Q 231.012 157.998, 229.88 157.998 Q 227.068 157.998, 225.553 156.282 Q 224.055 154.566, 224.055 151.352 \" fill=\"#00CC00\"/>\n",
       "<path class=\"atom-9\" d=\"M 235.595 143.975 L 237.275 143.975 L 237.275 157.834 L 235.595 157.834 L 235.595 143.975 \" fill=\"#00CC00\"/>\n",
       "<path class=\"bond-0\" d=\"M 545.922,125.31 L 564.916,122.241\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0\" d=\"M 564.916,122.241 L 583.91,119.171\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 534.904,118.776 L 526.449,102.311\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 526.449,102.311 L 517.994,85.8462\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 583.91,119.171 L 590.909,74.0616\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2\" d=\"M 590.909,74.0616 L 550.171,53.4659\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3\" d=\"M 550.171,53.4659 L 517.994,85.8462\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4\" d=\"M 517.994,85.8462 L 472.885,78.8474\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5\" d=\"M 472.885,78.8474 L 445.937,42.0016\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10\" d=\"M 472.885,78.8474 L 436.039,105.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6\" d=\"M 445.937,42.0016 L 409.091,68.9497\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7\" d=\"M 409.091,68.9497 L 436.039,105.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 436.039,105.795 L 433.105,124.707\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 433.105,124.707 L 430.171,143.619\" style=\"fill:none;fill-rule:evenodd;stroke:#00CC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"atom-0\" d=\"M 532.912 126.491 Q 532.912 123.386, 534.446 121.652 Q 535.98 119.917, 538.846 119.917 Q 541.713 119.917, 543.247 121.652 Q 544.781 123.386, 544.781 126.491 Q 544.781 129.631, 543.229 131.421 Q 541.676 133.192, 538.846 133.192 Q 535.998 133.192, 534.446 131.421 Q 532.912 129.649, 532.912 126.491 M 538.846 131.731 Q 540.818 131.731, 541.877 130.416 Q 542.955 129.083, 542.955 126.491 Q 542.955 123.952, 541.877 122.674 Q 540.818 121.378, 538.846 121.378 Q 536.874 121.378, 535.797 122.656 Q 534.738 123.934, 534.738 126.491 Q 534.738 129.102, 535.797 130.416 Q 536.874 131.731, 538.846 131.731 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-9\" d=\"M 424.055 151.352 Q 424.055 148.138, 425.553 146.458 Q 427.068 144.76, 429.935 144.76 Q 432.601 144.76, 434.025 146.641 L 432.82 147.627 Q 431.779 146.258, 429.935 146.258 Q 427.981 146.258, 426.94 147.572 Q 425.918 148.869, 425.918 151.352 Q 425.918 153.908, 426.977 155.223 Q 428.054 156.538, 430.136 156.538 Q 431.56 156.538, 433.222 155.679 L 433.733 157.049 Q 433.057 157.487, 432.035 157.743 Q 431.012 157.998, 429.88 157.998 Q 427.068 157.998, 425.553 156.282 Q 424.055 154.566, 424.055 151.352 \" fill=\"#00CC00\"/>\n",
       "<path class=\"atom-9\" d=\"M 435.595 143.975 L 437.275 143.975 L 437.275 157.834 L 435.595 157.834 L 435.595 143.975 \" fill=\"#00CC00\"/>\n",
       "<path class=\"bond-0\" d=\"M 144.89,325.477 L 160.939,322.883\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0\" d=\"M 160.939,322.883 L 176.988,320.29\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 134.941,318.849 L 126.467,302.348\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 126.467,302.348 L 117.994,285.846\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 185.102,311.493 L 188.005,292.777\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 188.005,292.777 L 190.909,274.062\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2\" d=\"M 190.909,274.062 L 150.171,253.466\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3\" d=\"M 150.171,253.466 L 117.994,285.846\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4\" d=\"M 117.994,285.846 L 72.8848,278.847\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5\" d=\"M 72.8848,278.847 L 45.9367,242.002\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10\" d=\"M 72.8848,278.847 L 36.039,305.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6\" d=\"M 45.9367,242.002 L 9.09091,268.95\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7\" d=\"M 9.09091,268.95 L 36.039,305.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 36.039,305.795 L 33.1048,324.707\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 33.1048,324.707 L 30.1706,343.619\" style=\"fill:none;fill-rule:evenodd;stroke:#00CC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"atom-0\" d=\"M 122.312 319.99 L 124.065 319.99 L 124.065 325.486 L 130.675 325.486 L 130.675 319.99 L 132.428 319.99 L 132.428 332.918 L 130.675 332.918 L 130.675 326.947 L 124.065 326.947 L 124.065 332.918 L 122.312 332.918 L 122.312 319.99 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-0\" d=\"M 135.989 319.99 L 140.225 326.837 Q 140.645 327.513, 141.32 328.736 Q 141.996 329.96, 142.033 330.033 L 142.033 319.99 L 143.749 319.99 L 143.749 332.918 L 141.978 332.918 L 137.431 325.431 Q 136.902 324.555, 136.336 323.551 Q 135.788 322.546, 135.623 322.236 L 135.623 332.918 L 133.944 332.918 L 133.944 319.99 L 135.989 319.99 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-1\" d=\"M 177.976 319.207 Q 177.976 316.103, 179.51 314.368 Q 181.044 312.634, 183.91 312.634 Q 186.777 312.634, 188.311 314.368 Q 189.845 316.103, 189.845 319.207 Q 189.845 322.348, 188.293 324.137 Q 186.741 325.909, 183.91 325.909 Q 181.062 325.909, 179.51 324.137 Q 177.976 322.366, 177.976 319.207 M 183.91 324.448 Q 185.882 324.448, 186.941 323.133 Q 188.019 321.8, 188.019 319.207 Q 188.019 316.669, 186.941 315.391 Q 185.882 314.095, 183.91 314.095 Q 181.938 314.095, 180.861 315.373 Q 179.802 316.651, 179.802 319.207 Q 179.802 321.818, 180.861 323.133 Q 181.938 324.448, 183.91 324.448 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-9\" d=\"M 24.0554 351.352 Q 24.0554 348.138, 25.5526 346.458 Q 27.0682 344.76, 29.9349 344.76 Q 32.6008 344.76, 34.0251 346.641 L 32.8199 347.627 Q 31.7791 346.258, 29.9349 346.258 Q 27.9812 346.258, 26.9404 347.572 Q 25.9178 348.869, 25.9178 351.352 Q 25.9178 353.908, 26.9769 355.223 Q 28.0542 356.538, 30.1358 356.538 Q 31.56 356.538, 33.2216 355.679 L 33.7329 357.049 Q 33.0573 357.487, 32.0348 357.743 Q 31.0122 357.998, 29.8802 357.998 Q 27.0682 357.998, 25.5526 356.282 Q 24.0554 354.566, 24.0554 351.352 \" fill=\"#00CC00\"/>\n",
       "<path class=\"atom-9\" d=\"M 35.5954 343.975 L 37.2753 343.975 L 37.2753 357.834 L 35.5954 357.834 L 35.5954 343.975 \" fill=\"#00CC00\"/>\n",
       "<path class=\"bond-0\" d=\"M 344.89,325.477 L 360.939,322.883\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0\" d=\"M 360.939,322.883 L 376.988,320.29\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 334.941,318.849 L 326.467,302.348\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9\" d=\"M 326.467,302.348 L 317.994,285.846\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 385.102,311.493 L 388.005,292.777\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1\" d=\"M 388.005,292.777 L 390.909,274.062\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2\" d=\"M 390.909,274.062 L 373.183,265.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2\" d=\"M 373.183,265.1 L 355.457,256.138\" style=\"fill:none;fill-rule:evenodd;stroke:#CCCC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3\" d=\"M 344.884,258.786 L 331.439,272.316\" style=\"fill:none;fill-rule:evenodd;stroke:#CCCC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3\" d=\"M 331.439,272.316 L 317.994,285.846\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4\" d=\"M 317.994,285.846 L 272.885,278.847\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5\" d=\"M 272.885,278.847 L 245.937,242.002\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10\" d=\"M 272.885,278.847 L 236.039,305.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6\" d=\"M 245.937,242.002 L 209.091,268.95\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7\" d=\"M 209.091,268.95 L 236.039,305.795\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 236.039,305.795 L 233.105,324.707\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8\" d=\"M 233.105,324.707 L 230.171,343.619\" style=\"fill:none;fill-rule:evenodd;stroke:#00CC00;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"atom-0\" d=\"M 322.312 319.99 L 324.065 319.99 L 324.065 325.486 L 330.675 325.486 L 330.675 319.99 L 332.428 319.99 L 332.428 332.918 L 330.675 332.918 L 330.675 326.947 L 324.065 326.947 L 324.065 332.918 L 322.312 332.918 L 322.312 319.99 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-0\" d=\"M 335.989 319.99 L 340.225 326.837 Q 340.645 327.513, 341.32 328.736 Q 341.996 329.96, 342.033 330.033 L 342.033 319.99 L 343.749 319.99 L 343.749 332.918 L 341.978 332.918 L 337.431 325.431 Q 336.902 324.555, 336.336 323.551 Q 335.788 322.546, 335.623 322.236 L 335.623 332.918 L 333.944 332.918 L 333.944 319.99 L 335.989 319.99 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-1\" d=\"M 377.976 319.207 Q 377.976 316.103, 379.51 314.368 Q 381.044 312.634, 383.91 312.634 Q 386.777 312.634, 388.311 314.368 Q 389.845 316.103, 389.845 319.207 Q 389.845 322.348, 388.293 324.137 Q 386.741 325.909, 383.91 325.909 Q 381.062 325.909, 379.51 324.137 Q 377.976 322.366, 377.976 319.207 M 383.91 324.448 Q 385.882 324.448, 386.941 323.133 Q 388.019 321.8, 388.019 319.207 Q 388.019 316.669, 386.941 315.391 Q 385.882 314.095, 383.91 314.095 Q 381.938 314.095, 380.861 315.373 Q 379.802 316.651, 379.802 319.207 Q 379.802 321.818, 380.861 323.133 Q 381.938 324.448, 383.91 324.448 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-3\" d=\"M 346.519 257.903 Q 346.665 257.958, 347.267 258.213 Q 347.87 258.469, 348.527 258.633 Q 349.203 258.779, 349.86 258.779 Q 351.083 258.779, 351.796 258.195 Q 352.508 257.593, 352.508 256.552 Q 352.508 255.84, 352.143 255.401 Q 351.796 254.963, 351.248 254.726 Q 350.7 254.488, 349.787 254.215 Q 348.637 253.868, 347.943 253.539 Q 347.267 253.21, 346.774 252.516 Q 346.3 251.823, 346.3 250.654 Q 346.3 249.029, 347.395 248.025 Q 348.509 247.02, 350.7 247.02 Q 352.197 247.02, 353.895 247.732 L 353.475 249.138 Q 351.923 248.499, 350.755 248.499 Q 349.495 248.499, 348.801 249.029 Q 348.107 249.54, 348.125 250.435 Q 348.125 251.129, 348.472 251.549 Q 348.838 251.969, 349.349 252.206 Q 349.878 252.443, 350.755 252.717 Q 351.923 253.082, 352.617 253.448 Q 353.311 253.813, 353.804 254.561 Q 354.315 255.292, 354.315 256.552 Q 354.315 258.341, 353.11 259.309 Q 351.923 260.258, 349.933 260.258 Q 348.783 260.258, 347.906 260.003 Q 347.048 259.765, 346.026 259.345 L 346.519 257.903 \" fill=\"#CCCC00\"/>\n",
       "<path class=\"atom-9\" d=\"M 224.055 351.352 Q 224.055 348.138, 225.553 346.458 Q 227.068 344.76, 229.935 344.76 Q 232.601 344.76, 234.025 346.641 L 232.82 347.627 Q 231.779 346.258, 229.935 346.258 Q 227.981 346.258, 226.94 347.572 Q 225.918 348.869, 225.918 351.352 Q 225.918 353.908, 226.977 355.223 Q 228.054 356.538, 230.136 356.538 Q 231.56 356.538, 233.222 355.679 L 233.733 357.049 Q 233.057 357.487, 232.035 357.743 Q 231.012 357.998, 229.88 357.998 Q 227.068 357.998, 225.553 356.282 Q 224.055 354.566, 224.055 351.352 \" fill=\"#00CC00\"/>\n",
       "<path class=\"atom-9\" d=\"M 235.595 343.975 L 237.275 343.975 L 237.275 357.834 L 235.595 357.834 L 235.595 343.975 \" fill=\"#00CC00\"/>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rdkit.Chem import Draw\n",
    "Draw.MolsToGridImage(mols)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0, 1, 2, 3, 4)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "core.GetSubstructMatch(core)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Make RGroup decomposition!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "rgroups = rdRGroupDecomposition.RGroupDecomposition(core)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i,m in enumerate(mols):\n",
    "    rgroups.Add(m)\n",
    "    if i == 10:\n",
    "        break"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We need to call process after all molecules are added to optimize the RGroups."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rgroups.Process()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "groups = rgroups.GetRGroupsAsColumns()\n",
    "frame = pd.DataFrame(groups)\n",
    "PandasTools.ChangeMoleculeRendering(frame)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "I would have preferred new cores to appear and the [*:2]-N-[*:2] depiction is a bit annoying...  Perhaps for round 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Core</th>\n",
       "      <th>R1</th>\n",
       "      <th>R2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img data-content=\"rdkit/molecule\" src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "HTML(frame.to_html())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python (conda rdkit_build)",
   "language": "python",
   "name": "rdkit_build"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
